﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

///Developed By Indie Studio
///https://assetstore.unity.com/publishers/9268
///www.indiestd.com
///info@indiestd.com

namespace IndieStudio.BugsBang.Utility
{
	[DisallowMultipleComponent]
	public class ScoreCounter : MonoBehaviour {

		/// <summary>
		/// The delay time.
		/// </summary>
		[Range(0,1)]
		public float delay = 0.01f;

		/// <summary>
		/// The increment value.
		/// </summary>
		[Range(0,10)]
		public int incrementValue = 1;

		/// <summary>
		/// From value.
		/// </summary>
		public int fromValue = 0;

		/// <summary>
		/// To value.
		/// </summary>
		public int toValue = 100;

		/// <summary>
		/// Whether to run on start.
		/// </summary>
		public bool runOnStart;

		/// <summary>
		/// The text component reference.
		/// </summary>
		public Text textReference;

		// Use this for initialization
		void Start () {
			if (textReference == null) {
				textReference = GetComponent<Text> ();
			}

			textReference.text = fromValue.ToString ();

			if (runOnStart) {
				Run ();
			}
		}

		/// <summary>
		/// Run this instance.
		/// </summary>
		public void Run(){
			StartCoroutine ("CounterCoroutine");
		}

		/// <summary>
		/// The Counter coroutine.
		/// </summary>
		private IEnumerator CounterCoroutine(){
			yield return 0;
			while (fromValue != toValue) {
				fromValue += incrementValue;
				textReference.text = fromValue.ToString ();
				yield return new WaitForSeconds (delay);
			}
		}

        public void TEXT1()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }
        public void TEXT2()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }
        public void TEXT3()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }

        public void TEXT4()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }

        public void TEXT5()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }

        public void TEXT6()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }

        public void TEXT8()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }

        public void TEXT9()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }

        public void TEXT10()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }

        public void TEXT11()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }

        public void TEXT12()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }

        public void TEXT13()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }

        public void TEXT14()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }

        public void TEXT15()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }

        public void TEXT16()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }

        public void TEXT17()
        {
            int textNum = 1;
            if (textNum == 1)
            {
                textNum = 2;
            }
        }
    }
}